package com.ruoyi.kiku.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.kiku.mapper.KikuRelationalNewsMapper;
import com.ruoyi.kiku.domain.KikuRelationalNews;
import com.ruoyi.kiku.service.IKikuRelationalNewsService;

/**
 * 关联新闻Service业务层处理
 *
 * @author TT
 * @date 2025-09-03
 */
@Service
public class KikuRelationalNewsServiceImpl implements IKikuRelationalNewsService
{
    @Autowired
    private KikuRelationalNewsMapper kikuRelationalNewsMapper;

    /**
     * 查询关联新闻
     *
     * @param id 关联新闻主键
     * @return 关联新闻
     */
    @Override
    public KikuRelationalNews selectKikuRelationalNewsById(Long id)
    {
        return kikuRelationalNewsMapper.selectKikuRelationalNewsById(id);
    }

    /**
     * 查询关联新闻列表
     *
     * @param kikuRelationalNews 关联新闻
     * @return 关联新闻
     */
    @Override
    public List<KikuRelationalNews> selectKikuRelationalNewsList(KikuRelationalNews kikuRelationalNews)
    {
        return kikuRelationalNewsMapper.selectKikuRelationalNewsList(kikuRelationalNews);
    }

    /**
     * 查询关联新闻列表根据news_id
     *
     * @param newsId 新闻id
     * @return 关联新闻
     */
    @Override
    public List<KikuRelationalNews> selectKikuRelationalNewsListByNewsId(Long newsId)
    {
        return kikuRelationalNewsMapper.selectKikuRelationalNewsListByNewsId(newsId);
    }

    /**
     * 新增关联新闻
     *
     * @param kikuRelationalNews 关联新闻
     * @return 结果
     */
    @Override
    public int insertKikuRelationalNews(KikuRelationalNews kikuRelationalNews)
    {
        kikuRelationalNews.setCreateTime(DateUtils.getNowDate());
        return kikuRelationalNewsMapper.insertKikuRelationalNews(kikuRelationalNews);
    }

    /**
     * 修改关联新闻
     *
     * @param kikuRelationalNews 关联新闻
     * @return 结果
     */
    @Override
    public int updateKikuRelationalNews(KikuRelationalNews kikuRelationalNews)
    {
        kikuRelationalNews.setUpdateTime(DateUtils.getNowDate());
        return kikuRelationalNewsMapper.updateKikuRelationalNews(kikuRelationalNews);
    }

    /**
     * 批量删除关联新闻
     *
     * @param ids 需要删除的关联新闻主键
     * @return 结果
     */
    @Override
    public int deleteKikuRelationalNewsByIds(Long[] ids)
    {
        return kikuRelationalNewsMapper.deleteKikuRelationalNewsByIds(ids);
    }

    /**
     * 删除关联新闻信息
     *
     * @param id 关联新闻主键
     * @return 结果
     */
    @Override
    public int deleteKikuRelationalNewsById(Long id)
    {
        return kikuRelationalNewsMapper.deleteKikuRelationalNewsById(id);
    }
}
